package org.wheel.plugins.toolkit.fieldrole;

import org.springframework.core.io.support.SpringFactoriesLoader;
import org.wheel.plugins.toolkit.sql.spi.FieldRoleSpi;
import org.wheel.plugins.toolkit.sql.spi.register.FieldRoleRegistry;

import java.util.List;

/**
 * 只要 jar 被加载就立即把内置规则灌进去；
 * 仍保留 ApplicationContextInitializer 做二次合并（幂等）
 */
public class FieldRoleStaticEarlyInitializer {

    static {
        List<FieldRoleSpi> spi =
                SpringFactoriesLoader.loadFactories(FieldRoleSpi.class,
                        FieldRoleRegistryInitializer.class.getClassLoader());
        FieldRoleRegistry.init(spi);   // 第一次灌规则
    }
}